package com.qiahao.mapper;

import java.text.MessageFormat;
import java.util.List;
import java.util.Map;

public class PhoneProvider {

    public String insertAll(Map map) {
        List<Object> list = (List<Object>) map.get("list");
        StringBuilder sb = new StringBuilder();
        sb.append("INSERT INTO phone (username,phone,createtime) VALUES ");
        MessageFormat mf = new MessageFormat("(#'{'list[{1}],#'{'list[{0}]},now())");
        for (int i = 0; i < list.size(); i++) {
            sb.append(mf.format(new Object[]{i}));
            if (i < list.size() - 1) {
                sb.append(",");
            }
        }
        return sb.toString();
    }
}
